<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" pageEncoding="utf-8"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<link rel="stylesheet"
	href="<c:url value="/resources/lib/bootstrap-3.3.5/css/bootstrap.min.css"/>" />
	<link href="/resources/lib/font-awesome-4.4.0/css/font-awesome.min.css"
	rel="stylesheet" type="text/css" />
	<link href="/resources/css/header.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet"
	href="<c:url value="/resources/css/common.css"/>" />
<link rel="stylesheet"
	href="<c:url value="/resources/css/dataAdaptor/excelType.css"/>" />
	<script src="<c:url value="/resources/lib/jquery-2.1.4.min.js" />"
	type="text/javascript"></script>
<script
	src="<c:url value="/resources/lib/bootstrap-3.3.5/js/bootstrap.min.js" />"
	type="text/javascript"></script>
<script
	src="<c:url value="/resources/lib/angular-1.4.7/angular.min.js"/>"
	type="text/javascript">
	
</script>
<script
	src="<c:url value="/resources/lib/ui-bootstrap-tpls-0.13.4.min.js"/>"
	type="text/javascript">
	
</script>

<script src="<c:url value="/resources/js/dataAdaptor/excelType.js" />"
	type="text/javascript"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Excel data adaptor</title>
</head>
<body ng-app="conversionTool">
<ng-include src="'/resources/viewPart/nav.html'" >
	
	</ng-include>
	<header>
	  <div class="head-line">
		<h3 class="head-title">Manage Data Adaptor</h3>
		</div>
	</header>

	<section class="container" ng-controller="excelTypeAdaptorCtrl as excel">
	<form role="form" name="excel.from" ng-submit="upload()" enctype="multipart/form-data" method="post" action="${updateURL}" class="form-horizontal">
			<!-- initial process -->
			<div ng-init="isEdit=${isEdit}"></div>
			<div ng-init="currentDataAdaptor.id='${dataAdaptor.id}'"></div>

			<div>
				<input type="hidden" ng-model="currentDataAdaptor.id" name="id"
					value="${dataAdaptor.id}" />
			</div>


			<div class="form-group text-center form-line">
                <div class="col-xs-offset-1 text-left">
                <label>View Detail:<span>
                {{currentDataAdaptor.adaptorName}}
                </span> 
                </label> 
                 </div>
                 </div>
                 
                 <div class="form-group text-center form-line">
                 <div class="col-xs-4 text-right">
                 <label for="adaptorName">Adaptor Name</label>
                 </div>
				<div class="col-xs-8"> 
				<input type="text" class="form-control" id="adaptorName" name="adaptorName" placeholder="please enter adaptor name"
					ng-init="currentDataAdaptor.adaptorName='${dataAdaptor.adaptorName}'"
					ng-model="currentDataAdaptor.adaptorName" ng-disabled="!isEdit" />
				</div> 
			</div>


			<div class="form-group text-center form-line">
			    <div class="col-xs-4 text-right">
				<label for="adaptorName">Description</label>
				</div>
				<div class="col-xs-8">
				<textarea id="description" class="form-control" name="description"
					ng-disabled="!isEdit" ng-model="currentDataAdaptor.description"
					ng-init="currentDataAdaptor.description='${dataAdaptor.description}'"> </textarea>
				</div>
			</div>

			<div id="excelDetail">
			<div class="form-group text-center form-line">
			<div class="col-xs-4 text-right">
				<label class="setting-lable">Excel Detail Setting</label> </div>
				<div class="col-xs-8"></div>
				</div>
				
				<div  class="form-group text-center form-line">
				    <div class="col-xs-4 text-right">
					<label for="sheetName">Sheet Name</label> </div>
					<div class="col-xs-8">
					 <input type="text"  class="form-control" name="sheetName" id="sheetName" value="${excelDataType.sheetName}"
						ng-disabled="!isEdit" />
				</div>
				</div>
  
   <div class="form-group text-center form-line">
   <div class="col-xs-4"></div>
				<div ng-show="!isEdit" class="col-xs-8">

					<table class="table table-bordered">
						<thead>
							<tr>
								<th>Sequence</th>
								<th>Column</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${dataAdaptor.header}" var="entry"
								varStatus="status">
								<tr>
									<td>${status.count}</td>
									<td>${entry}</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>

				</div>
				</div>
				

			</div>

			<div class="form-group text-center form-line" ng-show="isEdit">


				<div class="col-xs-4 text-right"><label for="csvTemplateFile">Upload Excel Template File </label> </div>
				<div class="col-xs-8">
				<input type="file" class="form-control" name="file"
					id="excelTemplateFile" ng-disabled="!isEdit" ng-model="uploadFile"
					single
					accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
			</div>
			</div>

			<div class="form-group text-right form-right">
				<input type="button" value="Edit" class="btn btn-primary" ng-disabled="isEdit" ng-click="edit()" /> 
				<input type="submit" value="Save" ng-disabled="!isEdit" class="btn btn-primary" /> 
				<input type="button" value="Filter" class="btn btn-primary" ng-disabled="isEdit" ng-click="filter()" /> 
				<input type="button" value="Formula" class="btn btn-primary" ng-disabled="isEdit" ng-click="formula()" />
			</div>
          
          <div class="form-group text-center form-line">
			<div class="control-group error">
			

					<span class="help-inline">${msg}</span>
			
			</div>
</div>

		</form>
	</section>


</body>
</html>
